type Vector {
    x: Integer,
    y: Integer
};

type Matrix {
    start: Vector,
    size: Vector
};

function String: &(Vector) => String
    & {x,y} => { "(?,?)" (x.{String}, y.{String}) };

function String: &(Matrix) => String
    & {start,size} => { "[?,?]" (start.{String}, size.{String}) };

do
    // TODO: test for the whole return value of ref call (pair[0], pair[1])
    let p := { |Vector| { x: 1, y: 2 } },
    let q1 := p.(x).{->},
    let q2 := (p.(x) <- 3),
    let q3 := (p.(y) <- -9),
    let u := { |Matrix| { start: p, size: q2 } },
    let v1 := u.(start).(x).{->},
    let v2 := (u.(start).(y) <- 4),
    let v3 := (u.(size).(x) <- 5),
    let str := [
        p.{String},
        q1.{String},
        q2.{String},
        q3.{String},
        v1.{String},
        v2.{String},
        v3.{String}
    ].{join \n},
    { os::println str }
    . { crash-on-error };

